package com.atguigu.controller;


import com.alibaba.dubbo.config.annotation.Reference;
import com.atguigu.service.HelloService;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

//@Controller
@RestController//为Controller和ResponseBody
@RequestMapping("/demo")
public class HelloController {
    @Reference
    //Controller中注入HelloService使用的是Dubbo提供的@Reference注解
    private HelloService helloService;
    @RequestMapping("/hello")
    //@ResponseBody
    public String sayHello(String name){
        //远程调用
       String result=helloService.sayHello(name);
        System.out.println(result);
        return result;
    }
}
